using System.Collections.Generic;
using Microsoft.VisualStudio;
using Microsoft.VisualStudio.Shell.Interop;

namespace Microsoft.WowAddonStudio.Tests.Common.Mocks
{
	/// <summary>
	/// 
	/// </summary>
	public class MockEnumWindowFrames : IEnumWindowFrames
	{
		private readonly List<IVsWindowFrame> frames;

		/// <summary>
		/// Initializes a new instance of the <see cref="MockEnumWindowFrames"/> class.
		/// </summary>
		/// <param name="frames">The frames.</param>
		public MockEnumWindowFrames(IEnumerable<IVsWindowFrame> frames)
		{
			this.frames = new List<IVsWindowFrame>(frames);
		}

		#region IEnumWindowFrames Members

		/// <summary>
		/// Nexts the specified celt.
		/// </summary>
		/// <param name="celt">The celt.</param>
		/// <param name="rgelt">The rgelt.</param>
		/// <param name="pceltFetched">The pcelt fetched.</param>
		/// <returns></returns>
		public int Next(uint celt, IVsWindowFrame[] rgelt, out uint pceltFetched)
		{
			pceltFetched = uint.MaxValue;
			//if (currentIndex < frames.Count || currentIndex < 0)
			//{
			//    currentIndex++;
			//    rgelt[0] = frames[0];
			//}
			return VSConstants.S_OK;
		}

		/// <summary>
		/// Skips the specified celt.
		/// </summary>
		/// <param name="celt">The celt.</param>
		/// <returns></returns>
		public int Skip(uint celt)
		{
			return VSConstants.S_OK;
		}

		/// <summary>
		/// Resets this instance.
		/// </summary>
		/// <returns></returns>
		public int Reset()
		{
			return VSConstants.S_OK;
		}

		/// <summary>
		/// Clones the specified ppenum.
		/// </summary>
		/// <param name="ppenum">The ppenum.</param>
		/// <returns></returns>
		public int Clone(out IEnumWindowFrames ppenum)
		{
			ppenum = new MockEnumWindowFrames(frames);
			return VSConstants.S_OK;
		}

		#endregion
	}
}